/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import Model.Agenda;
import Model.Categorie;
import Model.Chambre;
import Model.Sejour;
import java.util.Date;
import java.util.LinkedList;
import javax.swing.JOptionPane;

/**
 *
 * @author Hugo
 */
public class SejourController extends AbstractController{
 
    public static final String LISTE_CHAMBRE_PROPERTY = "ListeChambre";
    
    public static final String ADD_CHAMBRE = "Chambre";
    
    public static final String SEJOUR_PROPERTY = "Sejour";
    
    public static final String CHANGE_CHAMBRE_PROPERTY = "Chambre";
    
    public static final String DTEFIN = "DateFin";
    
    public static final String DTEDEBUT = "DateDebut";
    
    public static final String NOT_ENOUGH_PLACE_EVENT = "Not enough place in Hotel";
    
    public void updateListeChambre(){
        updateProperty(LISTE_CHAMBRE_PROPERTY);
    }

    public void addChambre(Chambre c) {
        addLineToModelProperty(ADD_CHAMBRE, c);   
    }
    
    public void addSejour(Sejour sejour){
        updateProperty(SEJOUR_PROPERTY);
    }
    
    public void setDteFin(Date dte){
        setModelProperty(DTEFIN, dte);
    }
    
    public void setDteDebut(Date dte){
        setModelProperty(DTEDEBUT, dte);
    }
    
    public void setListeChambre(LinkedList<Chambre> liste){
        updateProperty(LISTE_CHAMBRE_PROPERTY);
    }
    
    public boolean trouveSejour(int numChambre){
        Sejour sejour = null;
        sejour = Agenda.getInstance().TrouverSejour(numChambre);
        if(sejour == null){
            JOptionPane.showMessageDialog(null, "Le séjour chercher n'existe pas.");
            return false;
        }
        else{
            this.addModel(sejour);
            updateProperty(SEJOUR_PROPERTY);
            return true;
        }
    }
    
    public void changeChambre(Integer numChambreCurrent, Integer newChambre){
        changeProperty(CHANGE_CHAMBRE_PROPERTY, numChambreCurrent, newChambre);
    }
}
